{% load admin_static material_admin i18n %}<!DOCTYPE html>
{% get_current_language as LANGUAGE_CODE %}
<html lang="{{ LANGUAGE_CODE|default:"en-us" }}">
    <head>
        {% block head %}
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
        {% block favicon %}<link href="{% static 'material/imgs/favicon.png' %}" rel="shortcut icon">{% endblock %}
        <title>{% block title %}{% endblock %}</title>
        {% block css %}
        {% include 'admin/includes/material_css.html' %}
        {% block extrastyle %}{% endblock %}
        {% endblock css %}
        {% block blockbots %}<meta name="robots" content="NONE,NOARCHIVE" />{% endblock %}
        {% block js %}
        <script src="{% static 'material/js/jquery.js' %}"></script>
        <script>
            // Use same django for material and django admin
            var django = django || {};
            django.jQuery = jQuery.noConflict(true);
            window.jQuery = window.$ = django.jQuery
        </script>
        <script type="text/javascript">window.__admin_media_prefix__ = "{% filter escapejs %}{% static "admin/" %}{% endfilter %}";</script>
        <script type="text/javascript">window.__admin_utc_offset__ = "{% filter escapejs %}{% now "Z" %}{% endfilter %}";</script>
        {% if user.is_authenticated %}<script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>{% endif %}
        {{ media.js }}
        {% endblock js %}
        {% block extrahead %}{% endblock %}
        {% endblock head %}
    </head>
    <body class="{% if is_popup %}popup{% endif %}">
        {% block body %}
        <header>
            {% block header %}
            {% if not is_popup %}
            <ul id="slide-out" class="side-nav fixed">
                {% block sidenav_header %}
                <li>
                    <div class="userView">
                        <img class="background" src="{% static 'material/imgs/sidenav.svg' %}">
                        {% block userphoto %}
                        {% if user.photo.url %}
                        <a href="#"><img class="circle" src="{{ user.photo.url }}"></a>
                        {% else %}
                        <a href="#"><img class="circle" src="{% static 'material/imgs/user.png' %}"></a>
                        {% endif %}
                        {% endblock %}
                        <a href="#"><span class="white-text name">{{ request.user.get_username|title }}</span></a>
                        <a href="#"><span class="white-text email">{{ request.user.email }}</span></a>
                    </div>
                </li>
                {% endblock %}
                {% block sidenav_items %}
                {% if site_url %}
                    {% block back_link %}<li class="no-padding"><a class="collapsible-header" href="{{ site_url }}"><i class="material-icons">arrow_back</i>{% trans 'View site' %}</a></li>{% endblock %}
                {% endif %}
                {% get_app_list request as app_list %}
                {% for app in app_list %}
                <li {% if app.active %}class="active"{% endif %}>
                    <ul class="collapsible collapsible-accordion">
                        <li>
                            <a class="collapsible-header{% if app.active %} active{% endif %}">{{ app.app_icon }} {{ app.name|truncatechars:23 }}</a>
                            <div class="collapsible-body" {% if app.active %}style="display:block"{% endif %}>
                                <ul>
                                    {% for model in app.models %}
                                    <li class="{% if model.active %}active{% endif %}">
                                        <a href="{{ model.admin_url }}">{% trans model.name %}</a>
                                    </li>
                                    {% endfor %}
                                </ul>
                            </div>
                        </li>
                    </ul>
                    {% endfor %}
                {% endblock sidenav_items %}
            </ul>
            {% endif %}
            {% endblock header %}
        </header>
        <main>
            {% block main %}
                {% block topbar %}
                <nav class="topbar">
                    <div class="nav-wrapper">
                        {% if not is_popup %}<a href="#" data-activates="slide-out" class="button-collapse"><i class="material-icons">menu</i></a>{% endif %}
                        <div class="brand-logo">
                            {% block page_title %}
                            <a href="/" class="page-title">{% block brand-logo %}{% trans 'Administration' %}{% endblock %}</a>
                            {% endblock %}
                        </div>
                        <ul id="nav-mobile" class="right hide-on-med-and-down">
                            {% block userlinks %}
                            {% if user.is_active and user.is_staff %}
                                {% url 'django-admindocs-docroot' as docsroot %}
                                {% if docsroot %}
                                    <li><a href="{{ docsroot }}">{% trans 'Documentation' %}</a></li>
                                {% endif %}
                            {% endif %}
                            {% if user.has_usable_password %}
                                <li><a href="{% url 'admin:password_change' %}">{% trans 'Change password' %}</a></li>
                            {% endif %}
                            {% if user.is_authenticated %}
                            <li><a href="{% url 'admin:logout' %}" data-turbolinks="false"><i class="material-icons right">exit_to_app</i>{% trans "Log out" %}</a></li>
                            {% else %}
                            <li><a href="{% url 'admin:login' %}" data-turbolinks="false"><i class="material-icons right">lock_open</i>{% trans "Log in" %}</a></li>
                            {% endif %}
                            {% endblock %}
                        </ul>
                    </div>
                </nav>
                {% endblock topbar %}
                {% block breadcrumbs %}
                {% if not is_popup %}
                <nav class="breadcrumbs">
                    <div class="nav-wrapper">
                        {% block breadcrumbs_items %}{% endblock %}
                    </div>
                </nav>
                {% endif %}
                {% endblock %}
                {% block main_content %}
                <div class="content">
                    {% block content %}{% endblock %}
                </div>
                {% endblock main_content %}
            {% endblock main %}
        </main>
        <footer>
            {% block footer %}
            {% endblock footer %}
        </footer>
        {% endblock body %}

        {% include 'admin/includes/material_js.html' %}
        {% block extrajs %}{% endblock %}

        {% block messages %}
        {% if messages %}
        <script type="text/javascript">
            $(document).ready(function() {
                {% for message in messages %}
                Materialize.toast('{{ message|capfirst }}', 10000, 'alert-{{ message.tags }}')
                {% endfor %}
            });
        </script>
        {% endif %}
        {% endblock messages %}
    </body>
</html>
